#include <iostream>

using namespace std;

typedef long long LL;
int main()
{
	int n; cin >> n;
	LL a = 1, b = 1, c = 2;
	for(int i = 3; i <= n; i++)
	{
		 t = a + b + c;
		a = b;
		b = c;
		c = t;
	}
	if(n == 1) cout << 1 << endl;
	else if(n == 2) cout << 2 << endl;
	else cout << c << endl;
	
	return 0;
}
